from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtWidgets import QVBoxLayout
from view.NetworkCapture import Ui_NetworkCapture


class NetworkCapture(QWidget,Ui_NetworkCapture):
    def __init__(self, frida_manager, log_out):
        super(NetworkCapture, self).__init__()
        self.setupUi(self)
        self.setLayout(self.verticalLayout)
        self.frida_manager = frida_manager
        self.log_out = log_out

        # btn = QPushButton('测试')
        # btn.clicked.connect(self.test)
        # v_box = QVBoxLayout()
        # v_box.addWidget(btn)
        # self.setLayout(v_box)

    def test(self):
        print(self.frida_manager.get_processes())

    def on_message(self, message, data):
        if message['type'] == 'send':
            text = message['payload']
            print(text)
        else:
            print(message)
